package com.zmzncs.lmtc.module.park.pojo.park_manager;

import com.zmzncs.lmtc.common.util.ExceptionUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Data
@ApiModel(description="校验短信验证码入参")
public class LoginForm {

    @ApiModelProperty(required = true, value="短信验证码")
    @NotBlank
    private String verifyCode;

    @ApiModelProperty(required = true, value="手机号")
    @NotBlank
    private String phoneNumber;

    protected void validateCustom() {
        //  判断手机号是否为数字
        Matcher phoneNumberIsNum = Pattern.compile("[0-9]*").matcher(phoneNumber);
        if( !phoneNumberIsNum.matches() ){
            ExceptionUtil.businessException("手机号错误");
        }
    }
}
